package abstract1;

import java.util.Scanner;

public class ShapeTester2 {
    public static void main(String[] args) {
        Scanner stdIn=new Scanner(System.in);
       // System.out.print("请输入图形的个数:");

        System.out.print("图形的个数是：");
        int x=stdIn.nextInt();

//        for (int i = 0; i < ; i++) {
//
//        }
        Shape[] s=new Shape[4];



        for (int i = 0; i <x ; i++) {//每个图形，都有4种选择

            System.out.print(i+1+"号图形的种类（1...点/2...横线/3...竖线/4...长方形):");
            int c=stdIn.nextInt();
            switch (c) {
                case 1:
                    s[i] = new Point();
                    break;
                case 2:
                    System.out.print("长度：");
                    int y=stdIn.nextInt();
                    s[i] = new HorzLine(y);
                    break;
                case 3:
                    System.out.print("长度：");
                    int z=stdIn.nextInt();
                    s[i]=new VertLine(z);break;
                case 4:
                    int height,width;
                    System.out.println("长度：");
                    height=stdIn.nextInt();
                    System.out.println("宽度：");
                    width=stdIn.nextInt();
                    s[i]=new Rectangle(width,height);break;

            }
        }


        for (int i = 0; i <s.length ; i++) {
            s[i].print();
        }

//        float height=stdIn.nextFloat();
//        float width=stdIn.nextFloat();
    }
}
